package com.hruiworks.campusgroup.initializer;

import com.hruiworks.campusgroup.utils.SpringContextUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;

/**
 * 项目初始化操作
 */
@Component
@Slf4j
public class ProjectInitializer {

    /**
     * 所有bean加载完毕后执行
     */
    @EventListener(ContextRefreshedEvent.class)
    public void afterAllBeansLoaded() {
        log.info("bean加载完毕...开始初始化项目...");
        RedisPre redisPre = SpringContextUtils.getBean(RedisPre.class);

        log.info("预热redis...");

        redisPre.universityPre();

//        redisPre.eachUniversityActivityCount();

        log.info("预热redis end");


    }
}
